Use a custom theme for CSS style tests
authorMatthias Clasen <mclasen@redhat.com>
Sun, 3 Jan 2016 20:37:40 +0000 (15:37 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 3 Jan 2016 20:39:55 +0000 (15:39 -0500)
Use a custom, empty theme and stop importing reset-to-defaults.css.
This avoids overwriting initial values, so our initial value
filtering works better.

testsuite/css/style/Empty.css [new file with mode: 0644]
testsuite/css/style/Makefile.am
testsuite/css/style/currentcolor.css
testsuite/css/style/inherit.css
testsuite/css/style/label.css
testsuite/css/style/nth-child.css
testsuite/css/style/reset-to-defaults.css [deleted file]
testsuite/css/style/test-css-style.c
testsuite/css/style/test-css-style.gresource.xml [new file with mode: 0644]

diff --git a/testsuite/css/style/Empty.css b/testsuite/css/style/Empty.css
new file mode 100644 (file)
index 0000000..e69de29
index bbd72ef6a1769a1ebd834f335bf2e01217490518..6ace19154eef5218ef06ecefee318be78581bf62 100644 (file)
@@ -14,15 +14,19 @@ test_css_style_CFLAGS = \
         -I$(top_builddir)/gdk           \
         -I$(top_srcdir)/gdk             \
         $(GTK_DEBUG_FLAGS)              \
-        $(GTK_DEP_CFLAGS)
+        $(GTK_DEP_CFLAGS)              \
+       $(NULL)
 
 test_css_style_LDADD = \
         $(top_builddir)/gdk/libgdk-3.la \
         $(top_builddir)/gtk/libgtk-3.la \
-        $(GTK_DEP_LIBS)
+        $(GTK_DEP_LIBS)                        \
+       $(NULL)
 
 test_css_style_SOURCES = \
-        test-css-style.c
+        test-css-style.c               \
+       resources.c                     \
+       $(NULL)
 
 test_data = \
         currentcolor.ui currentcolor.css        currentcolor.nodes \
@@ -31,7 +35,19 @@ test_data = \
        nth-child.ui    nth-child.css           nth-child.nodes \
        $(NULL)
 
-EXTRA_DIST += $(test_in_files) $(test_data)
+BUILT_SOURCES = resources.c
+
+resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(builddir)/test-css-style.gresource.xml)
+
+resources.c: test-css-style.gresource.xml $(resource_files)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/test-css-style.gresource.xml
+
+EXTRA_DIST += \
+       test-css-style.gresource.xml    \
+       $(resource_files)               \
+       $(test_in_files)                \
+       $(test_data)                    \
+       $(NULL)
 
 if BUILDOPT_INSTALL_TESTS
 insttestdir=$(libexecdir)/installed-tests/$(PACKAGE)/css/style
@@ -48,7 +64,6 @@ $(test_files): %.test: %.test.in
        $(AM_V_GEN) sed $(substitutions) $< > $@.tmp && mv $@.tmp $@
 
 EXTRA_DIST += \
-       reset-to-defaults.css   \
        $(test_files)           \
        $(NULL)
 
index 6c8bbdedd1e38b25243e54609fdbcd67b8bdff1c..68b3f5d5a9d582a75561a27a56ff6df69f3578e7 100644 (file)
@@ -1,5 +1,3 @@
-@import "reset-to-defaults.css";
-
 box {
   color: red;
 }
index 61ac21a3120f0d962ee20cae15dd99ae4d12ed91..6eefc78e2cbc06c92bcd05a5a226a3df3ba54040 100644 (file)
@@ -1,5 +1,3 @@
-@import "reset-to-defaults.css";
-
 box {
   color: red;
   opacity: 0.5;
index 76b190df591251d92986a3593d18d74d11ef11a8..5d38bf25d36b67f31260d9e27488f6fdc412db3e 100644 (file)
@@ -1,5 +1,3 @@
-@import "reset-to-defaults.css";
-
 box {
   font: "Comic Sans";
 }
index 96265b2acc1b1a290d1114632e5095a7df8bbff8..6d7ca66c74aa108efeaec4445df24f1ceba99019 100644 (file)
@@ -1,5 +1,3 @@
-@import "reset-to-defaults.css";
-
 label:first-child {
   font-size: 20px;
 }
diff --git a/testsuite/css/style/reset-to-defaults.css b/testsuite/css/style/reset-to-defaults.css
deleted file mode 100644 (file)
index a739419..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-* {
-  all: unset;
-}
index c0470a10632ee62594f7a828ae2aa98782571e9f..53fac070e5bc8e7a308f4c77cd468a3d0a515450 100644 (file)
@@ -245,6 +245,7 @@ main (int argc, char **argv)
 
   g_object_set (gtk_settings_get_default (),
                 "gtk-font-name", "Sans",
+                "gtk-theme-name", "Empty",
                 NULL);
   if (argc < 2)
     {
diff --git a/testsuite/css/style/test-css-style.gresource.xml b/testsuite/css/style/test-css-style.gresource.xml
new file mode 100644 (file)
index 0000000..1625b86
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gtk/libgtk/theme">
+    <file>Empty.css</file>
+  </gresource>
+</gresources>